package service;

import dao.StudentDao;
import model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;

@Service
public class StudentService {
    private StudentDao dao;
    @Autowired
    public void setStudentDao(StudentDao dao){
        this.dao=dao;
    }
    public boolean deleteStudent(String sno){
        return dao.deleteStudent(sno)>0;
    }
    //按照学号或班级查询学生信息
    public ArrayList<Student> getStudent_sno(String sno){
        return dao.findStudentBySno(sno);
    }
    public ArrayList<Student> getStudent_id(String classId){
        return dao.findStudentByClassid(classId);
    }
    public ArrayList<Student> getAllStudents(){
        return dao.getAllStudents();
    }
    public boolean editStudent(Student student){
        return dao.editStudent(student)>0;
    }
    public boolean addStudent(Student student){
        return  dao.addStudent(student)>0;
    }

}
